package com.zijiebutiao.config;


import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyBatisPlusConfig {

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();

        //添加内部的分页插件
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());

        return interceptor;
    }
}
//示例代码
//        //数据库的分页查询
//        IPage<Student> page = new Page<>(currentPage,pageSize);
//        //使用mybatisplus的分页插件，实现分页查询
//        studentService.page(page);

//数据库的分页查询 pageHelper
//        PageHelper.startPage(currentPage,pageSize);
//                List<Student> students=studentService.list();
//        PageInfo<Student> pageInfo=new PageInfo<>(students);